/*
 * Printing proper factors and counting prime numbers
 * Suggested exercises:
 * - Print the sum of the proper factors
 * - For each number print if it is deficient, abundant or perfect.
 * - Count how many numbers are deficient, abundant and perfect.
 */

public class Factors
{
    public static void main (String[] args)
    {
        int n, f, fcount, p;
        p = 0;
        for (n = 1; n<=20; n++)
        {
            System.out.print(n + "\t"); 
            fcount = 0;
            for (f = 1; f <= n/2; f++)
                if (n % f == 0)
                {
                    System.out.print(f + " ");
                    fcount++;
                }
            if (fcount == 1) 
                p++;
            System.out.println();    
         }
            System.out.println("Number of primes = " + p); 
    }
}
